# -*-coding:utf-8-*-
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

plt.rcParams['font.sans-serif'] = ['KaiTi']  # 解决中文乱码问题
plt.rcParams['axes.unicode_minus'] = False  # 解决负号不显示问题
name = ['谭火', '孙庄', '卢黄', '余钗', '程欢', '杨婵']
chinese = np.random.randint(20, 90, 6)
math = np.random.randint(20, 90, 6)
data = pd.DataFrame({'name': name, 'chinese': chinese, 'math': math})

"""
# 绘制子图方式一
figure = plt.figure()
axes1 = figure.add_subplot(2, 2, 1)
axes2 = figure.add_subplot(2, 2, 2)
axes1bar(data.name, data.chinese)
axes2.plot(data.name, data.math)
# 绘制子图方式二
figure, axes = plt.subplots(2, 2)
axes[0][0].bar(data.name, data.chinese)
axes[0][1].plot(data.name, data.math)
"""
figure, axes = plt.subplots(2, 2)
axes[0][0].bar(data.name, data.chinese)
axes[0][1].plot(data.name, data.math)
plt.show()